package com.kyk;

/**
 * Hello world!
 *
 */
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@EnableDiscoveryClient
public class UploadServicesApp implements WebMvcConfigurer
{
    public static void main( String[] args )
    {
        SpringApplication.run(UploadServicesApp.class, args);
    }

    @Value("${upload.webPath}")
    String webPath;
    @Value("${upload.diskPath}")
    String diskPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(webPath + "**")
                .addResourceLocations("file:" + diskPath);
    }
}
